package com.lancoo.cvas.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lancoo.cvas.entity.TeachingClass;
import com.lancoo.cvas.entity.TeachingClassStudent;
import com.lancoo.cvas.entity.TeachingClassTeacher;
import com.lancoo.cvas.pojo.common.PageInfo;
import com.lancoo.cvas.pojo.dto.HourTypeDto;
import com.lancoo.cvas.pojo.dto.TeachingClassWeekScheduleDto;
import com.lancoo.cvas.pojo.vo.*;
import com.lancoo.cvas.util.Result;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 教学班
 *
 * @author liufeng
 * @email 1037383243@qq.com
 * @date 2023-12-04 11:54:00
 */
public interface TeachingClassService extends IService<TeachingClass> {


    Integer deletedByClassInfos(Integer taskId);

    Integer addBatch(Integer taskId, List<ClassInfoVo> classInfoVos);

    Integer addBatchByMajor(Integer taskId, List<GradeVo> gradeInfoVos);

    /**
     * 批量新增教学班
     *
     * @param taskId
     * @return
     */
    String addBatchTeachingClass(Integer taskId, Boolean isUpdate);

    /**
     * 获得生成的教学班信息
     *
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseType
     * @param keyword
     * @return
     */
    TeachingClassDtoVo getTeachingClassList(Integer taskId, String gradeId, String majorId, Integer courseType, String keyword);


    /**
     * 修改是否需要选课
     *
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseId
     * @return
     */
    Integer updateTeachingClassType(Integer taskId, String gradeId,Integer courseId, Integer courseType,Integer teachingClassType);

    /**
     * 修改教学班任务
     *
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseId
     * @param nums
     * @param isUpdate
     * @return
     */
    String modifyTeachingClassNum(Integer taskId, ModifyTeachingClassNumDto modifyTeachingClassNumDto);

    /**
     * 修改考核方式
     *
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseId
     * @param assessmentId
     * @return
     */
    String modifyAssessment(Integer taskId, String gradeId,  Long courseId, Long assessmentId);

    /**
     * 添加授课方式
     *
     * @param taskId
     * @param hourTypeInput
     * @return
     */
    String addHourType(Integer taskId, HourTypeInput hourTypeInput);

    /**
     * 删除授课方式
     *
     * @param taskId
     * @param hourTypeInput
     * @return
     */
    String deletedHourType(Integer taskId, HourTypeInput hourTypeInput);

    /**
     * 分配教师
     *
     * @param taskId
     * @param
     * @param majorId
     * @param courseId
     * @param teacherIds
     * @return
     */
    Boolean assignTeachers(Integer taskId,AssignTeachersDto assignTeachersDto);

    /**
     * 修改场地Id
     *
     * @param taskId
     * @param groupId
     * @param majorId
     * @param courseId
     * @param roomType
     * @return
     */
    String modifyRoomType(Integer taskId, String gradeId, Long courseId, Integer hourType,Integer roomType);

    /**
     * 修改周数
     *
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseId
     * @param courseId1
     * @param flag
     * @param week
     * @return
     */
    String updateWeek(Integer taskId, String gradeId, Long majorId, Long courseId,Integer hourType,  Integer flag, String week);





    List<RuleTeachingClassVo> getRuleTeachingClass(Integer taskId,Long roomId, Long teacherId, Long classId, Long teachingClassId);

    /**
     * 获取简单教学班 所有包括未排课课时
     * @param page
     * @param taskId
     * @return
     */
    PageInfo<TeachingClassWeekScheduleDto> getTeachingClassAllSchedule(IPage page, Integer taskId, List<Long> teachingClassIds);

    /**
     * @Description: 多教师  教师相关课表
     * @Author: liufeng
     * @Date: 2024/2/22 18:16
     * @param page:
     * @param taskId:
     * @param teachingClassTeachers:
     * @return:
     */
    PageInfo<TeachingClassWeekScheduleDto> getTeachingClassAllSchedule(Page<TeachingClassWeekScheduleDto> page, Integer taskId, List<TeachingClassTeacher> teachingClassTeachers);

    /**
     * @Description: 已排课时的课表
     * @Author: liufeng
     * @Date: 2023/12/28 15:37
     * @param page:
     * @param taskId:
     * @param teachingClassIds:
     * @return:
     */
    PageInfo<TeachingClassWeekScheduleDto> getTeachingClassSchedule(IPage page, Integer taskId, List<Long> teachingClassIds, Long roomId);


    /**
     * 确定在线选课获取在线选课教学班列表
     * @param page
     * @param taskId
     * @param handleState
     * @param courseId
     * @param keyWord
     * @param minClassNum
     * @return
     */
    PageInfo<TeachingClassCourseDto> getSelectionTeachingClass(Page<TeachingClassCourseDto> page, Integer taskId, Integer handleState, Long courseId, String keyWord, Integer minClassNum);

    /**
     * 批量修改教学班状态
     * @param teachingClassIdList
     * @param isEnable
     */
    void updateTeachingClassEnable(List<Long> teachingClassIdList, Integer isEnable);

    /**
     * 统计教学班相关数据
     * @param taskId
     * @param teachingClassType
     * @param minClassNum
     * @return
     */
    PublishStatisticsPre preStatistics(Integer taskId, Integer teachingClassType, Integer minClassNum);

    /**
     * 获取重修相关信息
     * @param taskId
     * @param schoolId
     * @param term
     * @return
     */
    RelatedNum getRelatedClassInfo(Integer taskId, String schoolId, String term);

    /**
     * 退选-统计
     * @param taskId
     * @return
     */
    PublishDeselectStatistic getDeselectStatistic(Integer taskId);

    /**
     *批量修改学生
     * @param teachingClassId
     * @param studentIds
     * @return
     */
    List<TeachingClassStudent> updateStudent(Long teachingClassId, List<Long> studentIds);

    String allTeachingClassToExcel(Integer taskId);


    List<TeachingClass> getTeachingClassIdsByRoomId(Integer taskId, Long roomId);


    /**
     * 发布选课计划
     * @param page
     * @param taskId
     * @param handleState
     * @param gradeId
     * @param majorId
     * @param keyWord
     * @param minClassNum
     * @return
     */
    PageInfo<TeachingClassCourseDto> getReleaseSelectionTeachingClass(Page<TeachingClassCourseDto> page, Integer taskId, Integer handleState, String gradeId, Long majorId, String keyWord, Integer minClassNum);


    /**
     * 导出在线选课
     * @param response
     * @param taskId
     * @param handleState
     * @param gradeId
     * @param gradeName
     * @param majorId
     * @param majorName
     * @param keyWord
     * @param minClassNum
     * @param currentPage
     * @param pageSize
     * @return
     */
    void csToExcel(HttpServletResponse response, Integer taskId, Integer handleState, String gradeId, String gradeName, Long majorId, String majorName, String keyWord, Integer minClassNum, Integer currentPage, Integer pageSize);


    /**
     * 恢复选课
     * @param taskId
     * @param recoverSelectionDto
     * @return
     */
    String recoverSelection(Integer taskId, RecoverSelectionDto recoverSelectionDto);

    String allTeachingClassToExcel(Integer taskId, String importMode);


    /**
     * 批量删除教学班相关数据
     * @param taskIds
     */
    void deleteClassRelated(List<Integer> taskIds);

    /**
     * 生成课程环节参数列表
     * @param taskId
     * @return
     */
    String addParameterSetting(Integer taskId);


    /**
     * 获取生成的教学班
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseType
     * @param keyword
     * @param currentPage
     * @param pageSize
     * @return
     */
    TeachingClassDtoVo getTeachingClassListV2(Integer taskId, String gradeId,Integer courseType, String keyword, Integer currentPage, Integer pageSize,Integer state);


    /**
     * 根据行政班id 获取行政班信息
     * @param taskId
     * @param classIds
     * @return
     */
    List<ClassInfoVoDto> getClassInfoByClassIds(Integer taskId, List<Long> classIds);


    /**
     * 修改教学班相关参数
     * @param taskId
     * @param gradeId
     * @param majorId
     * @param courseId
     * @param hourType
     * @param week
     * @param totalWeekNum
     * @param connectSection
     * @param connectNumber
     * @return
     */
    Result modifyTeachingClassInfo(Integer taskId, String gradeId, Long courseId, Integer flag, Integer hourType, String week, Integer totalWeekNum, Integer connectSection, Integer connectNumber,Integer sign,Integer startWeek,Integer endWeek);

    /**
     * 返回单双周是传单还是双
     * @param taskId
     * @return
     */
    Integer oddEvenWeekStatistics(Integer taskId);


    String addHourTypeByTeachingClassIds(Integer taskId, HourTypeDto hourTypeDto);

    String deletedHourTypeByTeachingClassIds(Integer taskId, HourTypeDto hourTypeDto);

    Boolean checkSubClass(Integer taskId, String gradeId, Long courseId);



    void excelToTeachingClass(HttpServletResponse response, Integer taskId, Integer flag, MultipartFile file);
}